<?php
include('../init.php');
include("../i.php");

/*登录后执行函数*/
function login() {
	global $config,$userInfo;
	$action = trim(_g('action'));
	$file = trim(_g('file'));
	if(!empty($action)&&!empty($file)) {
		//权限控制
		$role = new Role();
		$roleId = $role->RoleX($file,$action);
		$bool = getRoleId($roleId,$userInfo['roleid']);
		if(empty($bool)) {
			include template('Role');
			exit;
		}
		//权限控制结束
		fileAction($action,$file);
		exit;
	}
	$charset = 'utf-8';
	$php_version = phpversion();
	$db = new Happy_db();
	$mysql_version = $db->version();
	$sysos = $_SERVER['SERVER_SOFTWARE'];
	$max_upload = ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'Disabled';
	$sys_mail = ini_get('sendmail_path') ? 'Unix Sendmail ( Path: '.ini_get('sendmail_path').')' : ( ini_get('SMTP') ? 'SMTP ( Server: '.ini_get('SMTP').')' :  'Disabled' );
	$ifcookie = isset($_COOKIE) ? "SUCCESS" : "FAIL";
	include template('manage/index');
}

/*默认执行方法*/
function showIndex() {
	$url = '../home/';
	$time = 2;
	$msg = '请登录后在进入';
	redirect($url,$time,$msg);
}

/*文件执行方法*/
function fileAction($action,$file) {
	$adminfile = './unitl/' . $file . '.php';
	if (is_file($adminfile)) {
		include $adminfile;
	} else {
		echo $adminfile;
		exit('此文件找不到');
	}
}
?>